

package functionalEnrichment.semanticSimilarity.semanticSimilarityCalculator.units;

import java.io.File;
import java.util.Map;
import functionalEnrichment.semanticSimilarity.semanticSimilarityCalculator.parsers.OboParser;


/**
 *
 * @author Jamie MacPherson
 */
public class Ontology {

    // type of GO ontology, referencing one of biological process, cellular component or molecular function
    private OntologyType ontologyType;
    
    // the root term
    private GoTerm root;

    // a map of all terms, by their accession (minus the non-numerical "GO:" prefix)
    private Map<Integer, GoTerm> goTerms;

    /**
     *
     * @return the OntologyType of this Ontology
     */
    public OntologyType getGoOntology() {
        return ontologyType;
    }

    /**
     *
     * @param goOntology set the OntologyType of this Ontology
     */
    public void setGoOntology(OntologyType goOntology) {
        this.ontologyType = goOntology;
    }

    /**
     *
     * @param root set the root term of this Ontology
     */
    public void setRoot(GoTerm root) {
        this.root = root;
    }
    /**
     *
     * @return the root GO term of this Ontology
     */
    public GoTerm getRoot() {
        return root;
    }

    /**
     * Will return an Ontology object given an .obo file with GO term information
     * and a given GO OntologyType (referencing biological process, cellular component or molecular function).
     * @param oboFile the .obo file that will be parsed
     * @param ontologyType the GO ontology reference
     * @return a new Ontology object.
     */
    public static Ontology getOntology(File oboFile, OntologyType ontologyType){
        System.out.println("getting ontology from obo file");
        OboParser parser = new OboParser();
        return parser.getOntology(oboFile, ontologyType);
    }

    /**
     *
     * @param goTerms sets the map of GO terms with integer identifier as the key
     */
    public void setGoTerms(Map<Integer, GoTerm> goTerms) {
        this.goTerms = goTerms;
    }

    /**
     *
     * @return gets the map of GO terms with integer identifier as the key
     */
    public Map<Integer, GoTerm> getGoTerms() {
        return goTerms;
    }

}
